package com.icedata.sika.core

import com.icedata.sika.bridge.SikaEvent

/**
 * 消息预处理器
 */
open class PreProcessor constructor(priority: Int = 5000, function: (SikaEvent, Sika) -> Result) :
    AbstractProcessor<SikaEvent, PreProcessor.Result>(function, priority) {

    constructor(priority: Int = 5000, function: (SikaEvent) -> Result) : this(
        priority,
        { message, _ -> function(message) }
    )

    override fun onMount(sika: Sika) {
//        TODO("Not yet implemented")
    }

    override fun onUnmount(sika: Sika) {
//        TODO("Not yet implemented")
    }

    /**
     * 预检测结果
     */
    enum class Result {
        /**
         * 通过预检测
         */
        ADOPT,

        /**
         * 交由后继处理
         */
        IGNORE,

        /**
         * 不通过检测，放弃后继检测
         */
        BLOCK
    }
}
